package com.tuiyun.ai.face;

import javax.annotation.PostConstruct;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import com.cnsugar.ai.face.SeetafaceBuilder;
import com.cnsugar.ai.face.SeetafaceBuilder.FacedbStatus;

@SpringBootApplication
public class FaceApplication {
	public static void main(String[] args) {
		SpringApplication.run(FaceApplication.class, args);
	}

	@PostConstruct
	public void init() {
		initSeetaface();
	}

	private void initSeetaface() {
		SeetafaceBuilder.build();// 系统启动时先调用初始化方法

		// 等待初始化完成
		while (SeetafaceBuilder.getFaceDbStatus() == SeetafaceBuilder.FacedbStatus.LOADING
				|| SeetafaceBuilder.getFaceDbStatus() == SeetafaceBuilder.FacedbStatus.READY) {
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}
